﻿/******************************************************************************
 *  All Rights Reserved , Copyright (C) 2012 , EricHu. 
 *  作    者： EricHu
 *  创建时间： 2012-7-20 16:35:50
 ******************************************************************************/
//--------------------------------------------------------------------
// All Rights Reserved , Copyright (C) 2012 , gt TECH, Ltd.
//--------------------------------------------------------------------

using System;
using System.Data;

namespace RDIFramework.BusinessEntity
{
  using RDIFramework.Utilities;

 /// <summary>
 /// CiTableColumnsEntity
 /// 表字段结构定义说明
 ///
 /// 修改纪录
 ///
 ///		2012-03-02 版本：1.0 EricHu 创建主键。
 ///
 /// 版本：1.0
 ///
 /// <author>
 ///		<name>EricHu</name>
 ///		<date>2012-03-02</date>
 /// </author>
 /// </summary>
 [Serializable]
 public partial class CiTableColumnsEntity
 {
     private int? id = null;
     /// <summary>
     /// 主键
     /// </summary>
     public int? Id
     {
         get
         {
             return this.id;
         }
         set
         {
             this.id = value;
         }
     }

     private String tableCode = string.Empty;
     /// <summary>
     /// 表
     /// </summary>
     public String TableCode
     {
         get
         {
             return this.tableCode;
         }
         set
         {
             this.tableCode = value;
         }
     }

     private String tableName = string.Empty;
     /// <summary>
     /// 表名
     /// </summary>
     public String TableName
     {
         get
         {
             return this.tableName;
         }
         set
         {
             this.tableName = value;
         }
     }

     private String columnCode = string.Empty;
     /// <summary>
     /// 表
     /// </summary>
     public String ColumnCode
     {
         get
         {
             return this.columnCode;
         }
         set
         {
             this.columnCode = value;
         }
     }

     private String columnName = string.Empty;
     /// <summary>
     /// 表名
     /// </summary>
     public String ColumnName
     {
         get
         {
             return this.columnName;
         }
         set
         {
             this.columnName = value;
         }
     }

     private int? isPublic = 0;
     /// <summary>
     /// 是公开
     /// </summary>
     public int? IsPublic
     {
         get
         {
             return this.isPublic;
         }
         set
         {
             this.isPublic = value;
         }
     }

     private int? columnAccess = 0;
     /// <summary>
     /// 列可访问
     /// </summary>
     public int? ColumnAccess
     {
         get
         {
             return this.columnAccess;
         }
         set
         {
             this.columnAccess = value;
         }
     }

     private int? columnEdit = 0;
     /// <summary>
     /// 列可修改
     /// </summary>
     public int? ColumnEdit
     {
         get
         {
             return this.columnEdit;
         }
         set
         {
             this.columnEdit = value;
         }
     }

     private int? columnDeney = 0;
     /// <summary>
     /// 限制访问
     /// </summary>
     public int? ColumnDeney
     {
         get
         {
             return this.columnDeney;
         }
         set
         {
             this.columnDeney = value;
         }
     }

     private int? useConstraint = null;
     /// <summary>
     /// 使用约束
     /// </summary>
     public int? UseConstraint
     {
         get
         {
             return this.useConstraint;
         }
         set
         {
             this.useConstraint = value;
         }
     }

     private String dataType = string.Empty;
     /// <summary>
     /// 数据类型
     /// </summary>
     public String DataType
     {
         get
         {
             return this.dataType;
         }
         set
         {
             this.dataType = value;
         }
     }

     private String targetTable = string.Empty;
     /// <summary>
     /// 目标表
     /// </summary>
     public String TargetTable
     {
         get
         {
             return this.targetTable;
         }
         set
         {
             this.targetTable = value;
         }
     }

     private int? isSearchColumn = 0;
     /// <summary>
     /// 是否是查询列
     /// </summary>
     public int? IsSearchColumn
     {
         get
         {
             return this.isSearchColumn;
         }
         set
         {
             this.isSearchColumn = value;
         }
     }

     private int? isExhibitColumn = 1;
     /// <summary>
     /// 是否是展示列
     /// </summary>
     public int? IsExhibitColumn
     {
         get
         {
             return isExhibitColumn;
         }
         set
         {
             isExhibitColumn = value;
         }
     }

     private int? enabled = 1;
     /// <summary>
     /// 有效
     /// </summary>
     public int? Enabled
     {
         get
         {
             return this.enabled;
         }
         set
         {
             this.enabled = value;
         }
     }

     private int? allowEdit = 1;
     /// <summary>
     /// 允许编辑
     /// </summary>
     public int? AllowEdit
     {
         get
         {
             return this.allowEdit;
         }
         set
         {
             this.allowEdit = value;
         }
     }

     private int? allowDelete = 1;
     /// <summary>
     /// 允许删除
     /// </summary>
     public int? AllowDelete
     {
         get
         {
             return this.allowDelete;
         }
         set
         {
             this.allowDelete = value;
         }
     }

     private int? deleteMark = 0;
     /// <summary>
     /// 删除标记
     /// </summary>
     public int? DeleteMark
     {
         get
         {
             return this.deleteMark;
         }
         set
         {
             this.deleteMark = value;
         }
     }

     private int? sortCode = null;
     /// <summary>
     /// 排序码
     /// </summary>
     public int? SortCode
     {
         get
         {
             return this.sortCode;
         }
         set
         {
             this.sortCode = value;
         }
     }

     private String description = string.Empty;
     /// <summary>
     /// 描述
     /// </summary>
     public String Description
     {
         get
         {
             return this.description;
         }
         set
         {
             this.description = value;
         }
     }

     private DateTime? createOn = DateTime.Now;
     /// <summary>
     /// 创建日期
     /// </summary>
     public DateTime? CreateOn
     {
         get
         {
             return this.createOn;
         }
         set
         {
             this.createOn = value;
         }
     }

     private String createUserId = string.Empty;
     /// <summary>
     /// 创建用户主键
     /// </summary>
     public String CreateUserId
     {
         get
         {
             return this.createUserId;
         }
         set
         {
             this.createUserId = value;
         }
     }

     private String createBy = string.Empty;
     /// <summary>
     /// 创建用户
     /// </summary>
     public String CreateBy
     {
         get
         {
             return this.createBy;
         }
         set
         {
             this.createBy = value;
         }
     }

     private DateTime? modifiedOn = null;
     /// <summary>
     /// 修改日期
     /// </summary>
     public DateTime? ModifiedOn
     {
         get
         {
             return this.modifiedOn;
         }
         set
         {
             this.modifiedOn = value;
         }
     }

     private String modifyUserId = string.Empty;
     /// <summary>
     /// 修改用户主键
     /// </summary>
     public String ModifyUserId
     {
         get
         {
             return this.modifyUserId;
         }
         set
         {
             this.modifyUserId = value;
         }
     }

     private String modifiedBy = string.Empty;
     /// <summary>
     /// 修改用户
     /// </summary>
     public String ModifiedBy
     {
         get
         {
             return this.modifiedBy;
         }
         set
         {
             this.modifiedBy = value;
         }
     }

     /// <summary>
     /// 构造函数
     /// </summary>
     public CiTableColumnsEntity()
     {
     }

     /// <summary>
     /// 构造函数
     /// </summary>
     /// <param name="dataRow">数据行</param>
     public CiTableColumnsEntity(DataRow dataRow)
     {
         this.GetFrom(dataRow);
     }

     /// <summary>
     /// 构造函数
     /// </summary>
     /// <param name="dataReader">数据流</param>
     public CiTableColumnsEntity(IDataReader dataReader)
     {
         this.GetFrom(dataReader);
     }

     /// <summary>
     /// 构造函数
     /// </summary>
     /// <param name="dataTable">数据表</param>
     public CiTableColumnsEntity(DataTable dataTable)
     {
         this.GetFrom(dataTable);
     }

     /// <summary>
     /// 从数据表读取
     /// </summary>
     /// <param name="dataTable">数据表</param>
     public CiTableColumnsEntity GetFrom(DataTable dataTable)
     {
         if ((dataTable == null) || (dataTable.Rows.Count == 0))
         {
             return null;
         }
         foreach (DataRow dataRow in dataTable.Rows)
         {
             this.GetFrom(dataRow);
             break;
         }
         return this;
     }

     /// <summary>
     /// 从数据行读取
     /// </summary>
     /// <param name="dataRow">数据行</param>
     public CiTableColumnsEntity GetFrom(DataRow dataRow)
     {
         this.Id = BusinessLogic.ConvertToInt(dataRow[CiTableColumnsTable.FieldId]);
         this.TableCode = BusinessLogic.ConvertToString(dataRow[CiTableColumnsTable.FieldTableCode]);
         this.TableName = BusinessLogic.ConvertToString(dataRow[CiTableColumnsTable.FieldTableName]);
         this.ColumnCode = BusinessLogic.ConvertToString(dataRow[CiTableColumnsTable.FieldColumnCode]);
         this.ColumnName = BusinessLogic.ConvertToString(dataRow[CiTableColumnsTable.FieldColumnName]);
         this.IsPublic = BusinessLogic.ConvertToInt(dataRow[CiTableColumnsTable.FieldIsPublic]);
         this.ColumnAccess = BusinessLogic.ConvertToInt(dataRow[CiTableColumnsTable.FieldColumnAccess]);
         this.ColumnEdit = BusinessLogic.ConvertToInt(dataRow[CiTableColumnsTable.FieldColumnEdit]);
         this.ColumnDeney = BusinessLogic.ConvertToInt(dataRow[CiTableColumnsTable.FieldColumnDeney]);
         this.UseConstraint = BusinessLogic.ConvertToInt(dataRow[CiTableColumnsTable.FieldUseConstraint]);
         this.DataType = BusinessLogic.ConvertToString(dataRow[CiTableColumnsTable.FieldDataType]);
         this.TargetTable = BusinessLogic.ConvertToString(dataRow[CiTableColumnsTable.FieldTargetTable]);
         this.IsSearchColumn = BusinessLogic.ConvertToInt(dataRow[CiTableColumnsTable.FieldIsSearchColumn]);
         this.Enabled = BusinessLogic.ConvertToInt(dataRow[CiTableColumnsTable.FieldEnabled]);
         this.AllowEdit = BusinessLogic.ConvertToInt(dataRow[CiTableColumnsTable.FieldAllowEdit]);
         this.AllowDelete = BusinessLogic.ConvertToInt(dataRow[CiTableColumnsTable.FieldAllowDelete]);
         this.DeleteMark = BusinessLogic.ConvertToInt(dataRow[CiTableColumnsTable.FieldDeleteMark]);
         this.SortCode = BusinessLogic.ConvertToInt(dataRow[CiTableColumnsTable.FieldSortCode]);
         this.Description = BusinessLogic.ConvertToString(dataRow[CiTableColumnsTable.FieldDescription]);
         this.CreateOn = BusinessLogic.ConvertToDateTime(dataRow[CiTableColumnsTable.FieldCreateOn]);
         this.CreateUserId = BusinessLogic.ConvertToString(dataRow[CiTableColumnsTable.FieldCreateUserId]);
         this.CreateBy = BusinessLogic.ConvertToString(dataRow[CiTableColumnsTable.FieldCreateBy]);
         this.ModifiedOn = BusinessLogic.ConvertToDateTime(dataRow[CiTableColumnsTable.FieldModifiedOn]);
         this.ModifyUserId = BusinessLogic.ConvertToString(dataRow[CiTableColumnsTable.FieldModifyUserId]);
         this.ModifiedBy = BusinessLogic.ConvertToString(dataRow[CiTableColumnsTable.FieldModifiedBy]);
         return this;
     }

     /// <summary>
     /// 从数据流读取
     /// </summary>
     /// <param name="dataReader">数据流</param>
     public CiTableColumnsEntity GetFrom(IDataReader dataReader)
     {
         this.Id = BusinessLogic.ConvertToInt(dataReader[CiTableColumnsTable.FieldId]);
         this.TableCode = BusinessLogic.ConvertToString(dataReader[CiTableColumnsTable.FieldTableCode]);
         this.TableName = BusinessLogic.ConvertToString(dataReader[CiTableColumnsTable.FieldTableName]);
         this.ColumnCode = BusinessLogic.ConvertToString(dataReader[CiTableColumnsTable.FieldColumnCode]);
         this.ColumnName = BusinessLogic.ConvertToString(dataReader[CiTableColumnsTable.FieldColumnName]);
         this.IsPublic = BusinessLogic.ConvertToInt(dataReader[CiTableColumnsTable.FieldIsPublic]);
         this.ColumnAccess = BusinessLogic.ConvertToInt(dataReader[CiTableColumnsTable.FieldColumnAccess]);
         this.ColumnEdit = BusinessLogic.ConvertToInt(dataReader[CiTableColumnsTable.FieldColumnEdit]);
         this.ColumnDeney = BusinessLogic.ConvertToInt(dataReader[CiTableColumnsTable.FieldColumnDeney]);
         this.UseConstraint = BusinessLogic.ConvertToInt(dataReader[CiTableColumnsTable.FieldUseConstraint]);
         this.DataType = BusinessLogic.ConvertToString(dataReader[CiTableColumnsTable.FieldDataType]);
         this.TargetTable = BusinessLogic.ConvertToString(dataReader[CiTableColumnsTable.FieldTargetTable]);
         this.IsSearchColumn = BusinessLogic.ConvertToInt(dataReader[CiTableColumnsTable.FieldIsSearchColumn]);
         this.Enabled = BusinessLogic.ConvertToInt(dataReader[CiTableColumnsTable.FieldEnabled]);
         this.AllowEdit = BusinessLogic.ConvertToInt(dataReader[CiTableColumnsTable.FieldAllowEdit]);
         this.AllowDelete = BusinessLogic.ConvertToInt(dataReader[CiTableColumnsTable.FieldAllowDelete]);
         this.DeleteMark = BusinessLogic.ConvertToInt(dataReader[CiTableColumnsTable.FieldDeleteMark]);
         this.SortCode = BusinessLogic.ConvertToInt(dataReader[CiTableColumnsTable.FieldSortCode]);
         this.Description = BusinessLogic.ConvertToString(dataReader[CiTableColumnsTable.FieldDescription]);
         this.CreateOn = BusinessLogic.ConvertToDateTime(dataReader[CiTableColumnsTable.FieldCreateOn]);
         this.CreateUserId = BusinessLogic.ConvertToString(dataReader[CiTableColumnsTable.FieldCreateUserId]);
         this.CreateBy = BusinessLogic.ConvertToString(dataReader[CiTableColumnsTable.FieldCreateBy]);
         this.ModifiedOn = BusinessLogic.ConvertToDateTime(dataReader[CiTableColumnsTable.FieldModifiedOn]);
         this.ModifyUserId = BusinessLogic.ConvertToString(dataReader[CiTableColumnsTable.FieldModifyUserId]);
         this.ModifiedBy = BusinessLogic.ConvertToString(dataReader[CiTableColumnsTable.FieldModifiedBy]);
         return this;
     }
  }
}
